﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    public class BestOfPairReplacement : Replacement
    {
        public List<bool[]> prev, curr;
        public double[] prev_objective, curr_objective;

        public BestOfPairReplacement(List<bool[]> prev, List<bool[]> curr, double[] prev_objective, double[] curr_objective)
        {
            this.curr = curr;
            this.prev = prev;
            this.curr_objective = curr_objective;
            this.prev_objective = prev_objective;
        }

        public override List<bool[]> returnNewGeneration()
        {
            List<bool[]> result = new List<bool[]>();
            
            for (int i = 0; i < prev.Count; i++)
            {
                if (prev_objective[i] < curr_objective[i])
                    result.Add(curr[i]);
                else
                    result.Add(prev[i]);
            }

            return result;
        }
    }
}
